package com.meichis.yndms.adapter;

import android.content.Context;

import com.meichis.mcsappframework.adapter.recyclerview.CommonAdapter;
import com.meichis.mcsappframework.adapter.recyclerview.base.ViewHolder;
import com.meichis.yndms.R;
import com.meichis.yndms.model.Notice;

import java.util.List;

/**
 * @author xmy
 * @title
 * @remake
 * @create 2021-05-10 17:15
 */
public class NoticeAdapter extends CommonAdapter<Notice> {

    public NoticeAdapter(Context context, int layoutId, List<Notice> datas) {
        super(context, layoutId, datas);
    }

    @Override
    protected void convert(ViewHolder holder, Notice notice, int position) {
        holder.setText(R.id.tv_title, notice.getNoticeTitle());
        holder.setText(R.id.tv_type, notice.getNoticeType());
        holder.setText(R.id.tv_date, notice.getPublishDate());
        // holder.setText(R.id.tv_time,notice.get());
        if (notice.isNoticeRead()) {
            holder.setBackgroundRes(R.id.iv_pic, R.mipmap.ico_read);
        } else {
            holder.setBackgroundRes(R.id.iv_pic, R.mipmap.ico_unread);
        }
    }
}
